Expressions can be as large as you like in most versions of C. In the XC8 compiler there are some limitations on how complex you can make them. This is not much of a problem; if you wanted to do lots of complicated maths you would not have bought a PICmicro to do it, and you can always break the expressions down into a series of statements if want to do really large ones. When the expression is worked out the normal rules of maths are obeyed:
result = 2 + 3 * 4 ;
This would set the result variable to 14, not 20, because as with normal maths the * operator will be used first. C gives particular operators levels of precedence which determines when they get applied first, and the * and / operators have a higher precedence than + and -. If you want to force the order of evaluation you can use brackets:
result = (2 + 3) * 4 ;
This would set result to 20. On the right you can see a program with a fairly hefty expression. See if you can work out the result.
/* Complexs Expression */
void main ( void )
{
/* create an integer variable */
int count = 1 ;
/* set the value to expression */
count = 2+3*4+count*7 ;
}